$(function(){
$('a.delete').click(function() {
  if (confirm('确定要删除吗?')) {
    var data = {};
    data.tags = [];
    $('input[name=tag]').each(function() {
      if ($(this).attr('checked') == 'checked') {
        data.tags.push($(this).val());
      }
    });
    data.collection_id = $(this).attr('data-collection-id');
    $.post('/tag/delete/', data, function(ret) {
      if (ret.code == 200) {
        alert('操作成功!');
        window.location.reload();
      } else {
        alert('操作失败!');
      }
    }, 'json')
  }
});
});
